package JavaCore;

public class WhileTest {

	public void ex1(){
		int sum=0;
		for(int i=1;i<=10;i++) 
			{
			sum += i;
			}
		System.out.println("sum = " + sum);
	}
	
	public void ex2(){
		int i=0;
		int s=0;
		while(i<10){
			i++;
			s=s+i;
			
		}
		System.out.println("s = " + s);
		
	}
	
	public void ex3(){
		for(int i=1;i<=5;i++){
			for(int j=1;j<=5;j++){
				System.out.printf("%3d",i);
			}
			System.out.println();
		}
	}
	
	public void ex4(){
		int i=1;
		
		while (i<=5)
		{
			int j=1;
			
			while (j<=5)
			{			
				System.out.printf("%3d",i);
				j++;				
			}
			System.out.println();
			i++;			
		}
		
		
	}
	
	
	
	public WhileTest(){
		
	}
	
	public static void main(String[] args) {
		WhileTest wt = new WhileTest();	
		
		wt.ex1();
		wt.ex2();		
		wt.ex4();
			


	}

}
